﻿using Adnc.Infra.Entities;
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace WYT.Usr.Repository.Entities
{
    /// <summary>
    /// 用户表
    /// </summary>
    [Table("usr_user"), Comment("用户信息"),Index(nameof(Account))]
    public class User : EfEntity
    {
        /// <summary>
        /// 用户账号
        /// </summary>
        [Comment("账号")]
        public int Account { get; set; }

        /// <summary>
        /// 昵称
        /// </summary>
        [MaxLength(100),Comment("昵称")]
        public string? Nickname { get; set; }

        /// <summary>
        /// 头像
        /// </summary>
        [MaxLength(500), Comment("头像")]
        public string? Head { get; set; }

        /// <summary>
        /// 性别（性别 0：未知、1：男、2：女）
        /// </summary>
        [Comment("性别（性别 0：未知、1：男、2：女）")]
        public int Gender { get; set; }

        /// <summary>
        /// 电话号码
        /// </summary>
        [MaxLength(11), Comment("电话号码")]
        public string? Tel { get; set; }

        /// <summary>
        /// 用户所在国家
        /// </summary>
        [MaxLength(100), Comment("用户所在国家")]
        public string? Country { get; set; }

        /// <summary>
        /// 用户所在省份
        /// </summary>
        [MaxLength(100), Comment("用户所在省份")]
        public string? Province { get; set; }

        /// <summary>
        /// 用户所在城市
        /// </summary>
        [MaxLength(100),Comment("用户所在城市")]
        public string? City { get; set; }

        /// <summary>
        /// 支付密码\提现密码
        /// </summary>
        [MaxLength(100), Comment("支付密码/提现密码")]
        public string? WithdrawalPassword { get; set; }
        /// <summary>
        /// App-OpenID
        /// </summary>
        [Comment("APP-OpenID")]
        public string? AppOpenID { get; set; }

        /// <summary>
        /// 小程序OpenID
        /// </summary>
        [MaxLength(50), Comment("小程序OpenID")]
        public string? AppletOpenID { get; set; }

        /// <summary>
        /// 公众号OpenID
        /// </summary>
        [MaxLength(50), Comment("公众号OpenID")]
        public string? GongZongHaoOpenID { get; set; }

        /// <summary>
        /// 开发平台UnionID
        /// </summary>
        [MaxLength(50), Comment("开发平台UnionID")]
        public string? UnionID { get; set; }

        /// <summary>
        /// 直属上级Id
        /// </summary>
        [Comment("直属上级Id")]
        public long SuperiorUser { get; set; }

        /// <summary>
        /// 会员状态 0：正常 1：冻结提现 2：冻结账户
        /// </summary>
        [Comment("状态 0：正常 1：冻结提现 2：冻结账户")]
        public int State { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Comment("创建时间")]
        public DateTime CreatTime { get; set; }

        /// <summary>
        /// 会员等级（1:普通;2:V0;3:V1;4:V2;5:V3;6:V4;7:V5）
        /// </summary>
        public int Grade { get; set; }

        /// <summary>
        /// 单量
        /// </summary>
        [Comment("单量")]
        public int ProxyIntegral { get; set; }

        /// <summary>
        /// 消费积分
        /// </summary>
        [Comment("消费积分")]
        public int ConsumptionPoints { get; set; }

        /// <summary>
        /// 是否可以升级,当用户购买了体验装以外的商品后才可以升级v1及更高等级
        /// </summary>
        [Comment("是否可以升级,当用户购买了体验装以外的商品后才可以升级v1及更高等级")]
        public bool IsUpgrade { get; set; } = false;

        /// <summary>
        /// 用户授权码
        /// </summary>
        [Comment("用户授权码"),MaxLength(50)]
        public string? AuthorizationCode { get; set; }

        /// <summary>
        /// 授权时间
        /// </summary>
        [Comment("授权时间"), MaxLength(50)]
        public DateTime? AuthorizationDate { get; set; }

        /// <summary>
        /// 最近登录时间
        /// </summary>
        [Comment("最近登录时间"), MaxLength(50)]
        public DateTime LastLoginTime { get; set; }
    }
}
